// @algorithm @lc id=253 lang=cpp 
// @title meeting-rooms-ii

// @test([[0,30],[5,10],[15,20]])=2
// @test([[7,10],[2,4]])=1
class Solution {
public:
    int minMeetingRooms(vector<vector<int>>& intervals) {
		priority_queue<int, vector<int>, greater<int>> minHeap;
		sort(intervals.begin(), intervals.end());
		for(auto & c : intervals){
			auto start = c[0], fin = c[1];
			if(minHeap.size() && minHeap.top()<= start)
				minHeap.pop();
			minHeap.push(fin);
		}
		return minHeap.size();
    }
};
